using System;
using System.Collections.Generic;
using System.Text;
using ACS.Compiler.Grammar.Impl;

namespace ACS.Compiler.Tree.Impl
{
    public class StructTypeDeclarer : TypeDeclarer
    {
        private string _name;
        private string _namespace;
        private int _count;

        public string Name
        {
            get { return _name; }
        }

        public string Namespace
        {
            get { return _namespace; }
        }

        public int Count
        {
            get { return _count; }
        }

        public override void Build()
        {
            _tag = Tags.Structure;
            TreeBase child = (TreeBase)getFirstChild();
            child.Build();
            _name = child.ToString();
            child = (TreeBase)getFirstChild().getNextSibling();
            if (child != null)
            {
                if (child.Token.Type == AcsParser.INT )
                {
                    _count = Int32.Parse(child.ToString());
                    child = (TreeBase) child.getNextSibling();
                }
                if (child != null)
                {
                    child.Build();
                    _namespace = _name;
                    _name = child.ToString();
                }
            }     
  
       
        }

    }
}
